﻿<%@ WebHandler Language="C#" Class="lists" %>
using Models;
using System;
using System.Web;
using Newtonsoft.Json;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using System.Net;
using Newtonsoft.Json.Linq;
using System.Collections;


public class lists : IHttpHandler {

    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";

        string openid = context.Request.Headers["X-ACCESS-USER"];//Header中的token

        var code = 1;
        var msg = "获取成功";
        var time = DateTime.Now;

        using (Entities bll = new Entities())
        {

            var Bpl = bll.User.Where(x => x.UIndirectParentId == openid);



               ArrayList lisitem = new ArrayList();
                foreach (var xx in Bpl)
                {
                    lisitem.Add(new
                    {
                        xx.UOpenID,
                        name = xx.UNickName,
                        state = _rky.getUstat(xx.Ustate.ToString()),
               
                           addtime =Convert.ToDateTime(xx.RegTime).ToString("yyyy-MM-dd HH:mm:ss")
                    });

                }



            var total =Bpl.Count();
            var per_page = 10;
            var current_page=1;
            var last_page=1;


            context.Response.Write(JsonConvert.SerializeObject(new { code,msg,time,data=lisitem}));

        }

        HttpContext.Current.Response.End();
        //context.Response.Write("Hello World");


    }

    public bool IsReusable {
        get {
            return false;
        }
    }




}